package com.mystudy.thread;

/**
 * @program: infoalgorithm
 * @description: 测试
 * @author: zhouzhilong
 * @create: 2019-06-24 10:20
 **/
public class DataDemo {
    private static final DataDemo instance = new DataDemo();

    public static DataDemo getInstance(){
        return instance;
    }



    /** logger */
    public synchronized void set() throws InterruptedException {
        for(int i = 0;i < 20000;i++){
            System.out.println("this is set:"+i);
        }
    }


    public synchronized void get() throws InterruptedException {
        for(int i = 0;i < 20000;i++){
            if(i == 1000){
                set();
            }
            System.out.println("this is get:"+i);
        }
    }
}
